**********************************************************
**	Replication do-file for "Governmment Policies and the Emergence of an Ethnic Dimension in Party Systems"
**	Author: Maayan Mor
**  TABLE 2
***********************************************************

clear all

/* SET DIRECTORY */

use "state wide.dta", clear

**		drop those districts in which the Liberals did not compete in some elections
drop if liberal67==. | liberal70==. | liberal73==. 

*******************
** Baseline sample
*******************
local controls industry c.priest_vicar##c.priest_vicar wittenberg paris DM_t urban c.monastery##c.monastery

**		(1)

reg gap6367_lib cathp_64 `controls' i.pv 
estadd local random  "Yes" 
estadd local controls "Yes"
estadd local rsq=round(e(r2), .01)
estadd local radj=round(e(r2_a), .01)
eststo m6367_fe

**		(2)

reg gap6770_lib cathp_64 `controls' i.pv
estadd local random  "Yes" 
estadd local controls "Yes"
estadd local rsq=round(e(r2), .01)
estadd local radj=round(e(r2_a), .01)
eststo m6770_fe

**		(3)

reg gap6370_lib cathp_64 `controls' i.pv
estadd local random  "Yes" 
estadd local controls "Yes"
estadd local rsq=round(e(r2), .01)
estadd local radj=round(e(r2_a), .01)
eststo m6370_fe

**		(4)

reg gap6373_lib cathp_64 `controls' i.pv
estadd local random  "Yes" 
estadd local controls "Yes"
estadd local rsq=round(e(r2), .01)
estadd local radj=round(e(r2_a), .01)
eststo m6373_fe


*******************************************
** Subsample-No polish territories
******************************************
keep if baseline_sample==0

local controls industry c.priest_vicar##c.priest_vicar wittenberg paris DM_t urban c.monastery##c.monastery

**		(1)

reg gap6367_lib cathp_64 `controls' i.pv
estadd local random  "Yes" 
estadd local controls "Yes"
estadd local rsq=round(e(r2), .01)
estadd local radj=round(e(r2_a), .01)
eststo m6367_fe_nbl

**		(2)

reg gap6770_lib cathp_64 `controls' i.pv
estadd local random  "Yes" 
estadd local controls "Yes"
estadd local rsq=round(e(r2), .01)
estadd local radj=round(e(r2_a), .01)
eststo m6770_fe_nbl

**		(3)

reg gap6370_lib cathp_64 `controls' i.pv
estadd local random  "Yes" 
estadd local controls "Yes"
estadd local rsq=round(e(r2), .01)
estadd local radj=round(e(r2_a), .01)
eststo m6370_fe_nbl

**		(4)

reg gap6373_lib cathp_64 `controls' i.pv
estadd local random  "Yes" 
estadd local controls "Yes"
estadd local rsq=round(e(r2), .01)
estadd local radj=round(e(r2_a), .01)
eststo m6373_fe_nbl

**************************************
** Export full tables
**************************************
esttab m6367_fe m6770_fe m6370_fe m6373_fe  m6367_fe_nbl m6770_fe_nbl m6370_fe_nbl  m6373_fe_nbl  ///
using "main_regression_table_full.tex", ///
replace b se  obslast order(cathp_64) eqlabels(none) compress  ///
mtitles( "63-67" "67-70" "63-70" "63-73" "63-67" "67-70" "63-70" "63-73") note(" ") ///
title("Full Table: Change in the Party Alignment of Catholics 1863-1873") label ///
nobaselevels  b(%9.3f) se(%9.3f) t(%9.1f)  s(controls random  rsq radj N, ///
label("Pre-1865 covariates" "Province FE"  "\(R^{2}\)" "\(R^{2}\) (adjusted)" "Observations") fmt(%9.0f)) 

************************************************
**	Calculate mean of DV and SD of DV and such
***********************************************
use "state wide.dta", clear

**		drop those districts in which the Liberals did not compete in some elections
drop if liberal67==. | liberal70==. | liberal73==. 

sum gap6367_lib 
sum gap6770_lib 
sum gap6370_lib 
sum gap6373_lib 

sum gap6367_lib if baseline_sample==0
sum gap6770_lib if baseline_sample==0
sum gap6370_lib if baseline_sample==0
sum gap6373_lib if baseline_sample==0
